Garbage collection is a form of automatic memory management in computing systems. A garbage collector attempts to detect objects no longer used by software applications or programs on the computer system and to recover memory occupied by the objects that are no longer used by software applications or programs running on the computing system. In one example, garbage collection can be contrasted with manual memory management in which a programmer specifies the objects to de-allocate and return to the memory system. Memory management, including garbage collection, can influence performance of the software applications running on the computing device.
Many programming languages include garbage collection. In some programming languages, garbage collection can be included as part of the language specification such as C#, Java, D, Go, and many scripting languages. Additionally, some languages such as C and C++ are designed for manual memory management but include garbage-collected implementations. Further, some languages such as C++ for Common Language Infrastructure (C++/CLI) allow for both garbage collection and manual memory management to co-exist in the same application by using separate memory segments for collected and manually managed objects. Garbage collection is often integrated into the language compiler and the runtime system.